<template>
  <div>
    <hzhy-form-renderer
      ref="formRender"
      v-model="formData"
      label-position="top"
      isFull
      :content="content"
    >
    </hzhy-form-renderer>
  </div>
</template>

<script>
import ProductConfigDialog from '@/container/configure/component/product-config-dialog'

export default {
  props: {
    componentData: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      formData: {},
    }
  },
  computed: {
    content() {
      return [
        {
          $id: 'titleZh',
          $type: 'input',
          label: '标题(中文)',
          $el: {
            placeholder: '请输入标题(中文)',
            clearable: true,
            maxlength: 300,
            showWordLimit: true,
          },
        },
        {
          $id: 'titleEn',
          $type: 'input',
          label: '标题(英文)',
          $el: {
            placeholder: '请输入标题(英文)',
            clearable: true,
            maxlength: 300,
            showWordLimit: true,
          },
        },
        {
          $id: 'subTitleZh',
          $type: 'input',
          label: '副标题(中文)',
          $el: {
            placeholder: '请输入副标题(中文)',
            clearable: true,
            maxlength: 300,
            showWordLimit: true,
          },
        },
        {
          $id: 'subTitleEn',
          $type: 'input',
          label: '副标题(英文)',
          $el: {
            placeholder: '请输入副标题(英文)',
            clearable: true,
            maxlength: 300,
            showWordLimit: true,
          },
        },
        {
          $id: 'list',
          label: '商品选择',
          component: ProductConfigDialog,
        },
      ]
    },
  },
  watch: {
    componentData: {
      handler(value) {
        // 初始化默认值
        this.formData = { ...value }
      },
      immediate: true,
    },
    formData: {
      handler(value) {
        this.$emit('change', value)
      },
      immediate: true,
      deep: true,
    },
  },
  methods: {},
}
</script>

<style lang="less" scoped>
.banner-item {
}
</style>
